package org.example.everyday;

import org.example.sward.tooffer.CQueue;

import java.util.ArrayDeque;
import java.util.Queue;

/**
 * <p>
 * Description:TODO 详细描述
 * <p>
 * <p>
 *
 * @author anlu
 * @date 2022/5/6 9:39
 */
public class Lc933 {
    Queue<Integer> queue;

    public static void main(String[] args) {
        Lc933 lc933 = new Lc933();
        //[1], [100], [3001], [3002]
        lc933.ping(1);
        lc933.ping(100);
        lc933.ping(3001);
        lc933.ping(3002);
        System.out.println("11");
    }

    public Lc933() {
        queue = new ArrayDeque<Integer>();
    }

    public int ping(int t) {
        queue.offer(t);
        while (queue.peek() < t - 3000){
            queue.poll();
        }
        return queue.size();
    }
}
